package cn.stylefeng.guns.modular.web.service.impl;

import cn.stylefeng.guns.base.pojo.page.LayuiPageFactory;
import cn.stylefeng.guns.modular.web.entity.CumulaDay;
import cn.stylefeng.guns.modular.web.entity.PeriodTime;
import cn.stylefeng.guns.modular.web.mapper.CumulaDayMapper;
import cn.stylefeng.guns.modular.web.mapper.PeriodTimeMapper;
import cn.stylefeng.guns.modular.web.service.ICumulaDayService;
import cn.stylefeng.guns.modular.web.service.IPeriodTimeService;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.Map;

/**
 * 描述：期数表 service业务层
 * 作者：chenhuiyan
 * 时间：2020-04-21
 */
@Service
@Transactional(readOnly = true)
public class PeriodTimeServiceImpl extends ServiceImpl<PeriodTimeMapper, PeriodTime> implements IPeriodTimeService {

    /**
     * 查询列表
     * @param params
     * @return
     */
    public Page<Map<String, Object>> list(Map<String, Object> params) {
        Page page = LayuiPageFactory.defaultPage();
        return this.baseMapper.list(page, params);
    }

    /**
     * 查询期数时间是否存在重叠
     * @param startTime
     * @param endTime
     * @param id
     * @return
     */
    public Integer getTimeDistinct(String startTime, String endTime, String id){
        return this.baseMapper.getTimeDistinct(startTime, endTime, id);
    }
}
